package com.zmc.lostfound.auth.vo;

import com.zmc.lostfound.common.valid.AddGroup;
import com.zmc.lostfound.common.valid.UpdateGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.io.Serializable;

/**
 * @author zmc
 * @description 用户&角色关联信息新增/修改请求体
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("用户&角色关联信息新增/修改请求体")
public class UserRoleSaveVO implements Serializable {

    private static final long serialVersionUID = 9044600501655044556L;

    /**
     * 用户&角色关联id
     */
    @ApiModelProperty("用户&角色关联id")
    @Null(message = "新增用户&角色关联信息: 用户&角色关联id必须为空", groups = {AddGroup.class})
    @NotNull(message = "修改用户&角色关联信息: 用户&角色关联id不能为空", groups = {UpdateGroup.class})
    @Min(value = 1, message = "修改用户&角色关联信息: 用户&角色关联id必须大于等于1", groups = {UpdateGroup.class})
    private Long id;

    /**
     * 用户id
     */
    @ApiModelProperty("用户id")
    @NotNull(message = "用户id不能为空", groups = {AddGroup.class, UpdateGroup.class})
    @Min(value = 1, message = "用户id必须大于等于1", groups = {AddGroup.class, UpdateGroup.class})
    private Long userId;

    /**
     * 角色id
     */
    @ApiModelProperty("角色id")
    @NotNull(message = "角色id不能为空", groups = {AddGroup.class, UpdateGroup.class})
    @Min(value = 1, message = "角色id必须大于等于1", groups = {AddGroup.class, UpdateGroup.class})
    private Long roleId;

    public UserRoleSaveVO(Long userId, Long roleId) {
        this.userId = userId;
        this.roleId = roleId;
    }

}
